from utils.base import BaseSerializer
from apps.elements.models import Element

from rest_framework import serializers


class ElementSerializers(BaseSerializer):
    page_id = serializers.CharField(source='page.id', read_only=True)
    page_name = serializers.CharField(source='page.name', read_only=True)
    page_url = serializers.CharField(source='page.url', read_only=True)
    module_name = serializers.CharField(source='page.module.name', read_only=True)
    plant_name = serializers.CharField(source='page.module.plant.name', read_only=True)
    plant_id = serializers.CharField(source='page.module.plant.id', read_only=True)

    class Meta:
        model = Element
        fields = '__all__'
